1
general::
Be deserved under the circumstances. For example, That punishment serves him right after what he's done to you. It is Also put as serves you right, as in It wasn't accepted? Serves you right for applying so late. These idioms use serve in the sense of "treat in a specified manner," in this case, justly. [Late 1500s]
American Heritage Idioms